package com.my.admin.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class Article implements Serializable {

    @TableId(type = IdType.AUTO)
    private Long id;
    private String title;
    private String imageId;
    private String articleDesc;
    private Integer views;
    private String link;
    private String content;
    private Long createUserId;

    @TableLogic
    private boolean isDelete;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    public Article(Long id, String title, String imageId, String articleDesc, Integer views, String link, String content, Long createUserId, boolean isDelete, Date createTime, Date updateTime) {
        this.id = id;
        this.title = title;
        this.imageId = imageId;
        this.articleDesc = articleDesc;
        this.views = views;
        this.link = link;
        this.content = content;
        this.createUserId = createUserId;
        this.isDelete = isDelete;
        this.createTime = createTime;
        this.updateTime = updateTime;
    }

    @TableField(exist = false)
    private Long[] tags;
    @TableField(exist = false)
    private String userName;
    @TableField(exist = false)
    private String tagText;
    @TableField(exist = false)
    private String imageName;
    @TableField(exist = false)
    private String imageLink;
    @TableField(exist = false)
    private Integer commentCount;

}
